package com.plm.maque.common.exception;

import lombok.Getter;
import lombok.Setter;

/**
 * @author Limi
 * @create 2020-06-27 13:15
 */
@Getter
@Setter
public class BizException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    /**
     * 错误码
     */
    protected String code;
    /**
     * 错误信息
     */
    protected String msg;

    public BizException() {
        super();
    }

    public BizException(IBaseError iBaseError) {
        super(iBaseError.getCode());
        this.code = iBaseError.getCode();
        this.msg = iBaseError.getMsg();
    }

    public BizException(IBaseError iBaseError, Throwable cause) {
        super(iBaseError.getCode(), cause);
        this.code = iBaseError.getCode();
        this.msg = iBaseError.getMsg();
    }

    public BizException(String msg) {
        super(msg);
        this.msg = msg;
    }

    public BizException(String code, String msg) {
        super(code);
        this.code = code;
        this.msg = msg;
    }

    public BizException(String code, String msg, Throwable cause) {
        super(code, cause);
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
